// index.ts
// 获取应用实例
import { H2oAd,H2oLifeTool } from '../../utils/bo';
import {dao} from '../../utils/repository';
Component({
  options: {styleIsolation: 'apply-shared'},
  data: {
    showDots: true,
    autoplay: true,
    interval: 2000,
    duration: 500,
    adCards:Array<H2oAd>(),
    lifeCards:Array<H2oLifeTool>(),
  },
  lifetimes:{
    created:function(){},
    attached: function () { 
      this.setData({adCards:dao.getAd(), lifeCards:dao.getLife()})
    }
  },
  methods: {
    // 事件处理函数
    onDoLife(e:any) {
      const data = e.currentTarget.dataset 
      let url = dao.getLifeUrl(data.name)
      if(url !== undefined){
        wx.navigateTo({url:url, fail:function(r:any){console.log(r)}})
      }
    },
  },
})
